import java.util.*;

/**
 * @author LKQ
 * @date 2022/6/13 21:34
 * @description
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextLine()) {
            String t = sc.nextLine();
            int len = t.length(), l = 0, r = 0;
            List<String> list = new ArrayList<>();
            char[] T = t.toCharArray();
            while (r < len) {
                l = r;
                while (r < len && Character.isLetter(T[r])) {
                    r++;
                }
                if (l != r) {
                    list.add(t.substring(l, r));
                }
                while (r < len && !Character.isLetter(T[r])) {
                    r++;
                }
            }
            int size = list.size();
            StringBuilder sb = new StringBuilder();
            for (int i = size - 1; i >= 0; i--) {
                sb.append(list.get(i)  + " ");
            }
            sb.deleteCharAt(sb.length() - 1);
            System.out.println(sb);
        }
    }
}
